package cn.itcast.haa.tool;

import com.alibaba.cloud.ai.toolcalling.amp.WeatherSearchService;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 高德地图工具
 *
 * @Author mr.wu
 * @Date 2025-11-7 15:31
 */
@Component
public class AmapTool {

    @Autowired
    private WeatherSearchService weatherSearchService;

    @Tool(description = "根据城市查询天气预报")
    public String getWeather(@ToolParam(description = "城市拼音（首字母大写）") String city){
        WeatherSearchService.Response resp = weatherSearchService.apply(new WeatherSearchService.Request(city));
        String message = resp.message();
        return message;
    }
}
